package com.ksd.pug.clound.api;

import com.ksd.pug.clound.pojo.SysUser;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class UserServiceFeignFallbackFactory implements FallbackFactory<UserServiceFeign> {

    @Override
    public UserServiceFeign create(Throwable arg0) {
        return new UserServiceFeign() {

            @Override
            public SysUser findUsers(Long id) {
                return fallback(id);
            }
        };
    }

    public SysUser fallback(Long id) {
        SysUser sysUser = new SysUser();
        sysUser.setId(-100L);
        return sysUser;
    }
}